package com.ylb.config;

import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;

import java.util.Collection;

/**
 * @author: ylb
 * @create: 2021.3.23
 */
public class YearMonthShardingAlgorithm implements PreciseShardingAlgorithm<String> {
    private static final String spl = "_";
    @Override
    public String doSharding(Collection<String> collection, PreciseShardingValue<String> preciseShardingValue) {
        String tbname = preciseShardingValue.getLogicTableName() + preciseShardingValue.getValue();     // order202102
        System.out.println(tbname);
        return tbname;
    }
}
